import 'package:cached_network_image/cached_network_image.dart';
import 'package:du_application/model/GoodsModel.dart';
import 'package:du_application/routes/application.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

Widget getGoodsDetailsGoodsCard(context, ForGoods goods) {
  return InkWell(
     onTap: () =>
          {Application.router.navigateTo(context, "/goods?id=${goods.id}")},
      child: Container(
      color: Colors.white,
        margin: EdgeInsets.all(0),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.center,
          children: <Widget>[
            Container(
              height: ScreenUtil().setHeight(180),
              child: CachedNetworkImage(
                imageUrl: goods.picUrl,
                height: ScreenUtil().setHeight(180),
                placeholder: (context, url) => Image.asset(
                  'assets/loading.jpg',
                  fit: BoxFit.fitWidth,
                ),
                // print("111");
              ),
            ),
            // Image.network("https://s2.ax1x.com/2020/01/09/lfJLQS.jpg",fit:BoxFit.fitWidth,),
            Container(
              height: ScreenUtil().setHeight(70),
              child: Text(goods.name,
                  style: TextStyle(
                    fontSize: ScreenUtil().setHeight(20),
                  ),
                  maxLines: 2,
                  textAlign: TextAlign.center,
                  overflow: TextOverflow.ellipsis),
            ),
            Container(
                height: ScreenUtil().setHeight(40),
                child: Row(
                  mainAxisAlignment: MainAxisAlignment.center,
                  crossAxisAlignment: CrossAxisAlignment.end,
                  children: <Widget>[
                    Text(
                      "￥",
                      style:
                          TextStyle(fontSize: ScreenUtil().setSp(20), fontWeight: FontWeight.bold),
                    ),
                    Text(
                      goods.retailPrice.toString(),
                      style: TextStyle(
                        fontWeight: FontWeight.bold,
                      ),
                      textAlign: TextAlign.center,
                    )
                  ],
                ))
          ],
        ),
      )
      );
}
